//
//  BZLanguageManager.h
//  YiCuiMiaoZhang
//
//  Created by allen on 2018/12/5.
//  Copyright © 2018 益萃网络科技（中国）有限公司. All rights reserved.
//

#import <Foundation/Foundation.h>
#define BZLocalizedString(key, comment) \
[[BZLanguageManager shareInstance] localizedStringForKey:key]
#define BZlocaliedKeyAndString(key, comment, keyFirst) \
[[BZLanguageManager shareInstance] localizedStringForKey:key jointString:comment ShowKeyFirst:keyFirst]
#define BZLocalizedAssignString(key,localized, comment) \
[[BZLanguageManager shareInstance] localizedAssign:localized ForKey:key]

typedef NS_ENUM(NSInteger, LanguageInfoType)
{
    LanguageCode,
    LanguageString,
    LanguageServerType,
};
/// 中文
UIKIT_EXTERN NSString * _Nonnull const kLocaliedAssignCn;
/// 英文
UIKIT_EXTERN NSString * _Nonnull const kLocaliedAssignEn;

typedef void(^sucess)(void);

NS_ASSUME_NONNULL_BEGIN

@interface BZLanguageManager : NSObject

@property (nonatomic, strong, readonly) NSBundle *languageBundle;

/**
 初始化
 */
+ (instancetype)shareInstance;

/**
 设置当前 Language
 */
- (void)setupCurrentLanguage;

/**
 国际化版 设置默认语言
 @param isEnglish yes:@"en" | no:@"zh-Hans
 */
- (void)setupInternationalDefaultLanguage:(BOOL)isEnglish;

/**
 保存 Language
 */
- (void)saveLanguageByIndex:(NSInteger)index sucess:(sucess)changeLanguageBlcok;


/**
 返回当前 语言信息（code language）

 @param type 需要返回的类型
 @return name or code or type
 */
- (NSString *)currentLanguageInfo:(LanguageInfoType)type;

/**
 获取本地文件路径

 @param local 本地文件 请传完整文件名 包括后缀名 如：My.Plist me_language.png
 @return path 路径
 */
- (NSString *)locatizedCurrentBundleWithName:(NSString *)local;

/**
 获国际化字符串

 @param key 标示
 @return value
 */
- (NSString *)localizedStringForKey:(NSString *)key;


/// 获取指定语言
/// @param localized 语言
/// @param key 标示
- (NSString *)localizedAssign:(NSString *) localized ForKey:(NSString *)key;

/**
 拼接国际化字符串
 
 @param key 标示
 @return value
 */
- (NSString *)localizedStringForKey:(NSString *)key jointString:(NSString *)str ShowKeyFirst:(BOOL)keyFirst;


/**
 当前语言是否是en

 @return true or false
 */
- (BOOL)currentLanguageIsEnglish;


/**
 获取所有语言
 @return languages
 */
- (NSArray *)AllLanguagesNames;

- (NSArray *)AllLanguagesCodes;

/**
 获取当前选择语言type
 */
- (NSString *)getSelectLanguageType:(NSInteger)index;

/**
 获取带文字的图片名称

 @param imageName 中文图片名称
 @return 中文 或 英文图片名称
 */
- (NSString *) localizedImageNameWithName:(NSString *) imageName;

@end

NS_ASSUME_NONNULL_END
